package wflow.remote.remote.utils;

import java.util.concurrent.*;

/**
 * @author zhoup
 */
public class ExecutorUtil {
    public static ExecutorService newFixedThreadPool(int count) {
        ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutor(count, count, 0,
                TimeUnit.MINUTES,
                new LinkedBlockingQueue<>(10)
                , new ThreadFactory() {
            @Override
            public Thread newThread(Runnable r) {
                Thread thread = new Thread(r);
                thread.setDaemon(true);
                return thread;
            }
        });
        return threadPoolExecutor;
    }
}
